const mongoose = require('mongoose');
const Schema = mongoose.Schema;

var date = new Date()
var mydate = date.toLocaleString("zh-CN")

let avatarImg = 'http://localhost:5000/public/img/headerImg/6165e801175a097333d0c06e255d396b.jpeg'

// Create Schema
const UserSchema = new Schema({
  name: {
    type: String,
    required: true
  },
  email: {
    type: String,
    required: true
  },
  password: {
    type: String,
    required: true
  },
  avatar: {
    type: String,
    default: avatarImg
  },
  identity: {
    type: String,
    required: true
  },
  date: {
    type: String,
    default: mydate
  }
});

module.exports = User = mongoose.model('users', UserSchema);